package comm.hg.fitter;


import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class guoLvQi implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public  void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain)
            throws IOException, ServletException {
        //强转为http请求、响应
        HttpServletRequest req1=(HttpServletRequest) req;
        HttpServletResponse resp1=(HttpServletResponse) resp;
        //设置 请求、响应编码方式
        req1.setCharacterEncoding("utf-8");
        resp1.setCharacterEncoding("utf-8");
        chain.doFilter(req1,resp1);
    }

    @Override
    public void destroy() {

    }
}
